import * as vscode from "vscode";

export const EXTENSION_NAME = "catcoder-vscode";

export const getConfig = <T>(key: string) => {
    const config = vscode.workspace.getConfiguration(EXTENSION_NAME);
    const value = config.get<T>(key);
    if (!value) {
        const message = `Internal Error: config ${EXTENSION_NAME}.${key} not found.`;
        vscode.window.showErrorMessage(message);
        throw new Error(message);
    }
    return value;
};
